/*
 * @Copyright: 2016 www.yyfax.com Inc. All rights reserved.
 */
package com.yyfax.pay.common.model.to;

import java.io.Serializable;

import com.yyfax.commons.json.JacksonUtil;
import com.yyfax.framework.model.Content;
import com.yyfax.framework.yyfax.enums.RspCodeEnum;

/**
 * 接口响应基类
 * 
 * @author jiangmy
 * @date 2016-12-12 17:37:50
 */
@SuppressWarnings("serial")
public class YYPayRsp<C extends Content> implements Serializable {
	protected int code;
	protected String message;
	protected String display;
	protected C content;

	/**
	 * 构造函数
	 */
	public YYPayRsp() {
	}

	/**
	 * 构造函数
	 * 
	 * @param code
	 * @param content
	 */
	public YYPayRsp(int code, C content) {
		super();
		this.code = code;
		this.content = content;
	}

	/**
	 * 构造函数
	 * 
	 * @param code
	 * @param message
	 * @param content
	 */
	public YYPayRsp(int code, String message, C content) {
		super();
		this.code = code;
		this.message = message;
		this.content = content;
	}

	/**
	 * 构造函数
	 * 
	 * @param code
	 * @param message
	 * @param display
	 * @param content
	 */
	public YYPayRsp(int code, String message, String display, C content) {
		super();
		this.code = code;
		this.message = message;
		this.display = display;
		this.content = content;
	}

	public YYPayRsp(RspCodeEnum code) {
		this(code, (String) null);
	}

	public YYPayRsp(RspCodeEnum code, String message) {
		super();
		this.code = code.getValue();
		this.display = code.getDisplay();
		this.message = message;
	}

	public YYPayRsp(RspCodeEnum code, C content) {
		super();
		this.code = code.getValue();
		this.display = code.getDisplay();
		this.content = content;
	}

	public void setRsp(RspCodeEnum code) {
		this.code = code.getValue();
		this.display = code.getDisplay();
	}

	public void setRsp(RspCodeEnum code, String message) {
		this.code = code.getValue();
		this.display = code.getDisplay();
		this.message = message;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getDisplay() {
		return display;
	}

	public void setDisplay(String display) {
		this.display = display;
	}

	public C getContent() {
		return content;
	}

	public void setContent(C content) {
		this.content = content;
	}

	@Override
	public String toString() {
		return JacksonUtil.nonullMapper.toJson(this);
	}
}
